<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">

        .one{
            width: 500px;
            height: 500px;
            background-color: gray;
        }
        .onee{
            height: 300px;
            background-color: purple;
            padding-left: 30px;
        }

    </style>
</head>
<body>

<!--如果宽度不设置，在子元素的width不会增加在padding小于子元素宽度时-->
<div class="one">
    <div class="onee"></div>
</div>

</body>
</html>